<template>
  <div class="detail-logistics">
    <p>
      <span>{{ logistics.list[0].time }}</span>
      <span>{{ logistics.list[0].text }}</span>
    </p>
    <a @click="openLogistics" href="javascript:;">查看物流</a>
    <!-- 查看物流 dialog -->
    <Teleport to="#model">
      <OrderLogistics ref="logisticsOrderCom" />
    </Teleport>
  </div>
</template>
<script setup>
import OrderLogistics from './order-logistics.vue'
const { logisticsOrder } = require('@/api/order')
const { ref } = require('@vue/reactivity')

const props = defineProps({
  order: {
    type: Object,
    default: () => ({}),
  },
})

const logistics = ref(null)
const data = await logisticsOrder(props.order.id)
logistics.value = data.result

const logisticsOrderCom = ref(null)
const openLogistics = () => {
  logisticsOrderCom.value.open(props.order)
}
</script>
<style scoped lang="less">
.detail-logistics {
  height: 50px;
  display: flex;
  align-items: center;
  padding: 0 30px;
  background-color: #f5f5f5;
  margin: 30px 50px 0;
  > p {
    flex: 1;
    span {
      color: #999;
      &:first-child {
        margin-right: 30px;
      }
    }
  }
  > a {
    color: @xtxColor;
    text-align: center;
  }
}
</style>
